package com.framework.controller.newcontroller;

import com.framework.entity.flow.FlowAccount;
import com.framework.exception.util.RespResult;
import com.framework.service.FlowAccountService;
import com.framework.service.NoticeReadService;
import com.framework.view.AssView;
import com.framework.view.FlowNoticeTerView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 功能描述: 通知控制器
 *
 * @author ck
 * @date 2018/10/22 13:46
 */
@RestController
@Api(value="通知消息模块",tags={"通知消息模块"})
@RequestMapping(value = "new/notice")
public class NewNoticeController {

	@Autowired
	private NoticeReadService noticeReadService;
	@Autowired
	private FlowAccountService flowAccountService;

	/**
	 * 消息通知数量
	 * @param token
	 * @return
	 */
	@GetMapping("user/getMessageNoticeCount")
	@ApiOperation("消息通知数量")
	public RespResult getMessageNoticeCount(String token) {
		Map<String,Object> map = noticeReadService.getMessageNoticeCount(token);
		return RespResult.ok().put("data",map);
	}

	/**
	 * 百易助手通知列表
	 * @param token
	 * @return
	 */
	@GetMapping("user/queryAssList")
	@ApiOperation("百易助手通知列表")
	@ApiImplicitParams({
			@ApiImplicitParam(name="token",value="登录产生的token",dataType="string", paramType = "query",required = true),
			@ApiImplicitParam(name="pageNo",value="分页参数 1开始",dataType="int", paramType = "query",required = true)
	})
	public RespResult queryAssList(String token,Integer pageNo) {
		List<AssView> list = flowAccountService.queryAssList(token,pageNo);
		return RespResult.ok().put("list",list);
	}


	/**
	 * 获取系统通知信息列表
	 * @param token
	 * @return
	 */
	@GetMapping("user/querySysNoticeList")
	@ApiOperation("获取系统通知信息列表")
	public RespResult querySysNoticeList(String token) {
		List<Map<String,Object>> list = noticeReadService.querySysNoticeList(token);
		return RespResult.ok().put("list",list);
	}

	/**
	 * 获取系统通知信息轮播
	 * @param token
	 * @return
	 */
	@GetMapping("user/queryCarouselNoticeList")
	@ApiOperation("获取系统通知信息轮播")
	public RespResult queryCarouselNoticeList(String token) {
		List<Map<String,Object>> list = noticeReadService.queryCarouselNoticeList(token);
		return RespResult.ok().put("list",list);
	}

}
